/**
 * 菜单详情对话框
 */
var CurrencyListDlg = {
    CurrencyListDlgData: {},
    ztreeInstance: null,
    validateFields: {
        goodsName: {
            validators: {
                notEmpty: {
                    message: '产品名称不能为空'
                }
            }
        },
        goodsCode: {
            validators: {
                notEmpty: {
                    message: '产品代码不能为空'
                }
            }
        }
    }
};

/**
 * 清除数据
 */
CurrencyListDlg.clearData = function () {
    this.CurrencyListDlgData = {};
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
CurrencyListDlg.set = function (key, val) {
    if(key!="status"){
        this.CurrencyListDlgData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
    }else{
        this.CurrencyListDlgData[key] = (typeof value == "undefined") ? $("input[name='radio']:checked").val() :value;
    }
    return this;
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
CurrencyListDlg.get = function (key) {
    return $("#" + key).val();
}

/**
 * 关闭此对话框
 */
CurrencyListDlg.close = function () {
    parent.layer.close(window.parent.CurrencyList.layerIndex);
}

/**
 * 收集数据
 */
CurrencyListDlg.collectData = function () {
    this.set('recharge_no').set('miner').set('confirm_transfer_time').set('trans_order_id');
    
   var str = this.CurrencyListDlgData["confirm_transfer_time"];
    if(str!=""){
    var date = new Date(str);
    date = format(date ,"yyyy-MM-dd hh:mm:ss");
    this.CurrencyListDlgData["confirm_transfer_time"]=date;//.getTime();
    
    }

}

format=function(date,format){
    var seperator1 = "-";
    var seperator2 = ":";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
            + " " + date.getHours() + seperator2 + date.getMinutes()
            + seperator2 + date.getSeconds();
    return currentdate;
}
CurrencyListDlg.validate = function () {
	if(this.CurrencyListDlgData["recharge_no"]==""){
		Feng.error("记录号不能为空！");
		return false;
	}
	if(this.CurrencyListDlgData["miner"]==""){
		Feng.error("转账旷工费不能为空！");
		return false;
	}
	if(this.CurrencyListDlgData["trans_order_id"]==""){
		Feng.error("转账交易记录号不能为空！");
		return false;
	}
	if(this.CurrencyListDlgData["confirm_transfer_time"]==""){
		Feng.error("时间不能为空！");
		return false;
	}
	
	return true;
}
/**
 * 提交修改
 */
CurrencyListDlg.editSubmit = function () {

    this.clearData();
    this.collectData();
    var req=this.validate();
    if(req){
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/currencyList/update",  
    		function (data) {
    	if(data["code"]==2){
    		Feng.error(data["message"] + "!");
    	}else{
        Feng.success("修改成功!");
        window.parent.CurrencyList.table.refresh();
        CurrencyListDlg.close();
  	}
    }, function (data) {
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    })
    ajax.set(this.CurrencyListDlgData);
    ajax.start();
    }
}




;
